import { http as request } from '@/http/http'

export interface DictDataVO {
  id: number
  sort: number
  label: string
  value: string
  dictType: string
  status: number
  colorType: string
  cssClass: string
  remark: string
  createTime: Date
}

// 查询字典数据（精简)列表
export function getSimpleDictDataList() {
  return request.get('/system/dict-data/simple-list')
}

// 查询字典数据列表
export function getDictDataPage(params: any) {
  return request.get('/system/dict-data/page', params)
}

// 查询字典数据详情
export function getDictData(id: number) {
  return request.get(`/system/dict-data/get?id=${id}`)
}

// 根据字典类型查询字典数据
export function getDictDataByType(dictType: string) {
  return request.get(`/system/dict-data/type?type=${dictType}`)
}

// 新增字典数据
export function createDictData(data: DictDataVO) {
  return request.post('/system/dict-data/create', data)
}

// 修改字典数据
export function updateDictData(data: DictDataVO) {
  return request.put('/system/dict-data/update', data)
}

// 删除字典数据
export function deleteDictData(id: number) {
  return request.delete(`/system/dict-data/delete?id=${id}`)
}

// 批量删除字典数据
export function deleteDictDataList(ids: number[]) {
  return request.delete(`/system/dict-data/delete-list?ids=${ids.join(',')}`)
}

// 导出字典数据
// export const exportDictData = (params: any) => {
//   return request.download(  '/system/dict-data/export-excel', params )
// }
